<?php

namespace app\api\model;


use app\admin\model\ttk\Player;
use app\admin\model\ttk\Room;
use fast\Random;

class TkRoom
{


    /**
     * @var Room
     */
    public Room $room;
    private int $nop;

    public function __construct(array $users)
    {

        $this->nop = sizeof($users);
        if (sizeof($users) < 3) {
            echo '最少3人参加';
            return false;
        }

        $this->room = Room::create([
            'name' => '测试间',
            'is_public' => 0,
            'nop' => $this->nop
        ]);

        echo '创建了房间：' . $this->room['id']  . PHP_EOL;




//        CREATE TABLE dummy (
//        `name` VARCHAR(50) NULL DEFAULT '' COMMENT '名称',
//	`ttk_room_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '房间ID',
//	`user_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户ID',
//	`pos` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '位置',
//	`role` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '角色',
//	`die` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态',
//	`life` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '体力'


    }


}